class Car(val plateNumber:String,val brand:String,val color:String,val price:Int){
  def drive(mileage:Double){
    println("驾驶" +mileage+ "公里")
  }
  def stop(){
    println("车已经停好！")
  }
  def oil(){
    println("汽车已加满油")
  }
}

class ElectricCar(plateNumber:String,brand:String,color:String,price:Int, batteryCapacity:Int, cruisingMileage:Double) extends Car(plateNumber:String,brand:String,color:String,price:Int){
  /*batteryCapacity电池容量,cruisingMileage续航里程*/
  override def drive(mileage:Double){
    if (cruisingMileage <= mileage){
      println("续航里程不足，请充电！！！") 
    }else{
      
      println("还能驾驶"+ (cruisingMileage-mileage) +"公里")
    }
  }
  def charge(electricity:Int){
    if (electricity<=50){
      println("正在充电")
    }
  }
}

